import axios from 'axios';

axios.defaults.baseURL = window.top.location.origin + '/movies-server';
axios.defaults.timeout = 10000;   //超时时间 ms，默认0 不限制

export const POST = (url, params) => {
    return axios.post(`${url}`, params).then(res => res.data);
};

export const GET = (url, params) => {
    return axios.get(`${url}`, {
        params: params
    }).then(res => res.data);
};

export const PUT = (url, params) => {
    return axios.put(`${url}`, params).then(res => res.data);
};

export const DELETE = (url, params) => {
    return axios.delete(`${url}`, {
        params: params
    }).then(res => res.data);
};